<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;

class Log extends BaseModel {
    use HasFactory;

    protected $table = "log";
    protected $fillable = [
        'user_id',
        'module',
        'action',
        'message',
        'data',
        'ip',
        'level',
        'site_id',
    ];
    protected $casts = ['data' => 'array'];
    protected $declares = [
        'module' => ['module', '='],
        'action' => ['action', '='],
        'userId' => ['user_id', '='],
        'level' => ['level', '='],
        'startDateTime' => ['created_at', '>='],
        'endDateTime' => ['created_at', '<='],
        'message' => ['message', 'like']
    ];
}
